package com.hooyh.service.Impl;

import com.hooyh.dao.UserRepository;
import com.hooyh.domian.User;
import com.hooyh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by hooyh on 2017/3/28.
 */
@Service
public class UserServiceImpl implements UserService {
    private final UserRepository repository;
    @Autowired
    public UserServiceImpl(UserRepository repository) {
        this.repository = repository;
    }

    @Override
    public User save(User user) {
        return repository.save(user);
    }

    @Override
    public boolean delete(Long id) {
        repository.delete(id);
        return true;
    }

    @Override
    public User find(Long id) {
        return repository.findOne(id);
    }
}
